package com.qbw.core.observable;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import android.text.TextUtils;

import com.qbw.app.BR;


/**
 * @author qinbaowei
 * @date 2017/8/28
 * @email qbaowei@qq.com
 */

public class ObservableString extends BaseObservable {
    private String mValue;

    @Bindable
    public String getValue() {
        return mValue;
    }

    public void setValue(String value) {
        mValue = value;
        notifyPropertyChanged(BR.value);
    }

    public boolean isEmpty() {
        return TextUtils.isEmpty(mValue);
    }

    public void setValueWithNoEvent(String value) {
        mValue = value;
    }

    public int getLength() {
        return mValue == null ? 0 : mValue.length();
    }
}
